import requests
import re
# 数据爬取

url='http://www.weather.com.cn/weather1d/101310201.shtml'
shuju=requests.get(url)
shuju.encoding='utf-8'

# 这条可以打印出爬取到的数据
# print(shuju.text)


# 数据处理

wenben=shuju.text
name=re.findall('<span class="name">([\u4e00-\u9fa5]*)</span>',wenben)
weather=re.findall('<span class="weather">([\u4e00-\u9fa5]*)</span>',wenben)
wd=re.findall('<span class="wd">(.*)</span>',wenben)
zs=re.findall('<span class="zs">([\u4e00-\u9fa5]*)</span>',wenben)

s=[]
rw=zip(name,weather,wd,zs)
for a,b,c,d in rw:
    s.append([a,b,c,d])
print(s)
print()
print()



for i in s:
    for j in i:
        print(j,end='     \t')
    print()



'''
<span class="name">桂林</span>
<span class="weather">阴转多云</span>
<span class="wd">17/21℃</span>
<span class="zs">适宜</span>
'''